package com.frank.kafka.web;

import com.frank.kafka.send.KafkaSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小石潭记
 * @date 2020/10/21 16:43
 * @Description: kafka的环境参考：https://blog.csdn.net/qq_33371766/article/details/87866533
 */
//@RestController
@RequestMapping("/kafka")
public class KafkaController {

    @Autowired
    private KafkaSender sender;

    @GetMapping("/send")
    public void test() {
        for (int i = 0; i < 3; i++) {
            //调用消息发送类中的消息发送方法
            sender.send();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
